#include<iostream>
#include<cstring>
using namespace std;
const int N = 10;
char mp[N][N];
int st[N];
int n, k;
int cnt, ans;
void dfs(int x)
{
	if (cnt == k) {
		ans++;
		return;
	}
	if (x >= n) {
		return;
	}
	for (int i = 0; i < n; i++) {
		if (!st[i] && mp[x][i] == '#') {
			st[i] = 1;
			cnt++;
			dfs(x + 1);
			cnt--;
			st[i] = 0;
		}
	}
	dfs(x+1);
}
int main()
{
	while (cin >> n >> k) {
		if (n == -1 && k == -1) {
			break;
		}
		cnt = 0;
		ans = 0;
		memset(mp, 0, sizeof(mp));
		memset(st, 0, sizeof(st));
		for (int i = 0; i < n; i++) {
			cin >> mp[i];
		}
		dfs(0);
		cout << ans << endl;
	}
	return 0;
}